<%@ Page Language="C#" MasterPageFile="~/master/admin.master" AutoEventWireup="true"
    CodeFile="send-newsletter.aspx.cs" Inherits="admin_send_newsletter" Title="Untitled Page" %>

<%@ Register Namespace="ECommerce.Library.Web" TagPrefix="ucc" %>
<%@ Register Src="~/controls/wucAdminValidator.ascx" TagName="AdminValidator" TagPrefix="wuc" %>
<asp:Content ID="cntMiddleContent" ContentPlaceHolderID="cphMiddleContent" runat="Server">
    <script type="text/javascript" src="<%=rootPath %>javascript/general/prototype.js"></script>
    <div class="admin-function-top">
        <ucc:ResponseMessage ID="uccResponseMessage" runat="server"></ucc:ResponseMessage>
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
            DisplayMode="BulletList" ShowMessageBox="true" HeaderText="Please correct the following:"
            CssClass="adminValidator" />
        <label>
            Subject</label><br />
        <asp:TextBox ID="tbxSubject" runat="server" Width="230px" CssClass="text"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tbxSubject"
            ErrorMessage="Subject is required" Display="dynamic" SetFocusOnError="true">
            <wuc:AdminValidator ID="AdminValidator1" runat="server" />
        </asp:RequiredFieldValidator>
        <br />
        <label>
            Email From</label><br />
        <asp:TextBox ID="tbxEmailFrom" runat="server" Width="230px" CssClass="text"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="tbxEmailFrom"
            ErrorMessage="Email From is required" Display="dynamic" SetFocusOnError="true">
            <wuc:AdminValidator ID="AdminValidator2" runat="server" />
        </asp:RequiredFieldValidator>
        <asp:RegularExpressionValidator runat="server" ID="revFromEmail" ControlToValidate="tbxEmailFrom"
            EnableClientScript="true" ErrorMessage="Incorrect Email Format" SetFocusOnError="true"
            ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
            <wuc:AdminValidator ID="AdminValidator30" runat="server" />
        </asp:RegularExpressionValidator>
        <br />
        <label>
            Email To</label><br />
        <asp:DropDownList runat="server" ID="ddlNewsLetterGroup" Width="235px">
        </asp:DropDownList>
        <input runat="server" type="checkbox" id="cbxIndividualEmail" onclick="javascript:CheckIndividual()" /><label>Individual
            Email</label><br />
        Please enter email addresses seperated by comma<br />
        <asp:TextBox ID="tbxEmailTo" runat="server" TextMode="MultiLine" CssClass="text"
            Height="62px"></asp:TextBox>
        <br />
        <label>
            Body</label>
        <br />
        <asp:TextBox runat="server" ID="tbEmailBody" TextMode="MultiLine"></asp:TextBox>
        <br />
        <div class="btn-place-holder">
            <asp:Button ID="btnSend2" runat="server" Text="Send" CssClass="button medium black"
                OnClick="Create_Click" />
            <asp:Button ID="btnPreview" runat="server" Text="Preview" CssClass="button medium white"
                OnClick="btnPreview_Click" />
        </div>
    </div>
    <br class="clear" />
    <script language="javascript" type="text/javascript">

        $(document).ready(function () {
            $('#<%= tbEmailBody.ClientID %>').ckeditor();
        });

        function CheckIndividual() {

            if ($('<%=cbxIndividualEmail.ClientID %>').checked) {
                $('<%= ddlNewsLetterGroup.ClientID %>').disabled = true;
                $('<%= tbxEmailTo.ClientID %>').disabled = false;
            }
            else {
                $('<%= ddlNewsLetterGroup.ClientID %>').disabled = false;
                $('<%= tbxEmailTo.ClientID %>').disabled = true;
            }
        }
        CheckIndividual();
    </script>
</asp:Content>
